<!-- 修改主题 -->
<template>
  <el-color-picker
    v-model="color"
    @change="change"
  />
</template>
<script>
import { themeChange } from '@/utils/common'
import useThemeStore from '@/store/theme'
export default {
  name: 'AppThemeChange'
}
</script>
<script setup>
const themeStore = useThemeStore()
const primary = themeStore.primary
const color = ref(primary || '#409eff')

const change = (data) => {
  // 设置主题色
  if (data) {
    themeChange(data)
    themeStore.primary = data
  } else {
    color.value = primary || '#409eff'
    themeChange(primary)
  }
}

</script>

<style scoped lang='scss'>
</style>
